# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-babelfish
pkgver=0.6.0
pkgrel=3
pkgdesc='A Python module to work with countries & languages'
arch=('any')
url='https://github.com/Diaoul/babelfish'
license=('BSD')
depends=('python' 'python-setuptools')
makedepends=('git' 'python-build' 'python-installer' 'python-poetry-core')
checkdepends=('python-pytest')
_commit='62ee6f572585ed4d0d1cde51374aa7afdfe8aed2'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  PYTHONPATH="$PWD:$PYTHONPATH" pytest
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
